import { createRouter, createWebHistory } from 'vue-router'
import { staticRoutes } from '@/router/routes'
// 引入导航进度条的方法
import { close, start } from '@/utils/nporgress'

const router = createRouter({
  history: createWebHistory(),
  routes: staticRoutes,
  scrollBehavior() {
    return { top: 0, left: 0 }
  }
})

// 引入导航进度条的方法
router.beforeEach((pre, next) => {
  start()
  // console.log(`去那个路由`, pre)
  // console.log(`之前是在那个路由`, next)
})

router.afterEach(() => {
  close()
})
// 导出路由
export default router
